package com.huawei.statistics.service.impl.member;

import com.huawei.statistics.dao.member.LogInfoDao;
import com.huawei.statistics.pojo.member.LogInfo;
import com.huawei.statistics.service.impl.common.BaseServiceImpl;
import com.huawei.statistics.service.member.LogInfoService;
import com.huawei.statistics.vo.common.HttpResult;
import com.huawei.statistics.vo.common.PageData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class LogInfoServiceImpl extends BaseServiceImpl implements LogInfoService {
	
	@Autowired 
	LogInfoDao logInfoDao;

	@Override
	public HttpResult getAllLogInfo() {
		
		return new HttpResult(HttpResult.OK,loadAllEntity(LogInfo.class));
	}
	



	@Override
	public HttpResult getLogInfoWithPage(int cur, int max) {
		
		PageData<LogInfo> pageData = new PageData<LogInfo>(cur, max);
		pageData.setDataList(logInfoDao.getLogInfoListWithPage(pageData));
		return new HttpResult(HttpResult.OK,pageData);
	}




	@Override
	public HttpResult getLogInfoByUserId(Long uid) {
		
		return new HttpResult(HttpResult.OK,getEntitiesByPropertyName(LogInfo.class, "userId", uid));
	}




	@Override
	public HttpResult getLogInfoById(Long id) {
		
		return new HttpResult(HttpResult.OK,getEntityById(id, LogInfo.class));
	}




	@Override
	public HttpResult addLogInfo(LogInfo logInfo) {
		
		return new HttpResult(HttpResult.OK,addEntity(logInfo));
	}

}
